package com.csii.adhoc.controller.dataunit;

import com.csii.adhoc.dataunits.UnitBase.UnitBaseVo;
import com.csii.adhoc.dataunits.service.UnitBaseService;
import com.csii.adhoc.util.DateUtils;
import com.csii.result.APIResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description: 组件基本信息控制层
 * @author: panChuanJiang
 * @create: 2021-02-19 17:01
 */
@RestController
@RequestMapping("dataUnits")
public class UnitBaseController {

    @Resource
    private UnitBaseService unitBaseService;

    @RequestMapping("unitBaseMaintain")
    public APIResult unitBaseMaintain(UnitBaseVo unitBaseVo){
        String userId = "admin";
        unitBaseVo.setUpdatedBy(userId)
                .setUpdatedDt(DateUtils.getDateString("yyyyMMddHHmmss"));
        return APIResult.successResult(unitBaseService.unitBaseMaintain(unitBaseVo,unitBaseVo.getOptMode()));
    }
}
